const fs = require('fs');
const express = require('express');
const router = express.Router();
const config = require('../../config.json');

// TODO 要考虑找不到文件的情况，返回标准的格式，而不是直接将内容返回
router.get('/get_record', async (req, res, next) => {
    const data = fs.readFileSync(config.logPath + req.query.id + '.log')
    console.log(typeof(data), data)
    res.send(data.toString());
    next()
});

module.exports = router;